<?php
include('..'.DIRECTORY_SEPARATOR.'db-connection'.DIRECTORY_SEPARATOR.'conn.php');
class clsAdminController
{
	
	function LoginProcess($username,$password)
	{
		$arrDataAdmin = array();
		$sql = "SELECT COUNT(*) as cntUser, int_role_assigned FROM tbl_user_master WHERE txt_user_name='".$username."' AND txt_password='".$password."' AND yn_is_active='Y' AND yn_is_deleted='N' ";
		$run = mysql_query($sql);
		while ($data = mysql_fetch_array($run))
		{
			$arrDataAdmin["count"] = $data['cntUser'];
			$arrDataAdmin["role"] = $data['int_role_assigned'];
		}
		if($arrDataAdmin["count"]=="1")
		{
			$role = $arrDataAdmin["role"];
		}
		else
		{
			$role="0";
		}
		
		return $role;
	}
	
	function getVideoDetailsByID($videoID)
	{
		
		$sql = "SELECT
		tvm.int_video_id, tvm.txt_video_title, tvm.txt_video_desc, tvm.txt_video_path, tvm.txt_thumb_video_path, tvm.txt_keywords,
		tvm.yn_is_public, tcm.category_name, tsm.subcat_name, tum.int_user_id, tum.txt_first_name, tum.txt_last_name
		FROM
		tbl_video_master tvm, tbl_user_master tum, tbl_category_mst tcm, tbl_subcategory_mst tsm
		WHERE
		tvm.int_uploader_user_id = tum.int_user_id
		AND tvm.int_cat_id = tcm.id
		AND tvm.int_sub_cat_id = tsm.id
		AND tvm.int_video_id = '".$videoID."'";
		$run = mysql_query($sql);
		$counter=0;
		$arrVideoDetails = array();
		while ($data = mysql_fetch_array($run))
		{
			$arrVideoDetails["int_video_id"] = stripslashes($data["int_video_id"]);
			$arrVideoDetails["txt_video_title"] = stripslashes($data["txt_video_title"]);
			$arrVideoDetails["txt_video_desc"] = stripslashes($data["txt_video_desc"]);
			$arrVideoDetails["txt_video_path"] = stripslashes($data["txt_video_path"]);
			$arrVideoDetails["txt_thumb_video_path"] = stripslashes($data["txt_thumb_video_path"]);
			$arrVideoDetails["txt_keywords"] = stripslashes($data["txt_keywords"]);
			$arrVideoDetails["yn_is_public"] = stripslashes($data["yn_is_public"]);
			$arrVideoDetails["category_name"] = stripslashes($data["category_name"]);
			$arrVideoDetails["subcat_name"] = stripslashes($data["subcat_name"]);
			$arrVideoDetails["int_user_id"] = stripslashes($data["int_user_id"]);
			$arrVideoDetails["txt_first_name"] = stripslashes($data["txt_first_name"]);
			$arrVideoDetails["txt_last_name"] = stripslashes($data["txt_last_name"]);
			$counter++;
		}
			
		return $arrVideoDetails;
	}
	
}